import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface GetApprovalDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDeleteById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDemandDeleteById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetDetailById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetGetById_ {
  /**
   * @description id
   */
  id: number;
}

export class Demand {
  /**
   * 根据id查看审批详情
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/approvalDetail/{id}
   * @secure
   */
  getApprovalDetailById = ({ id }: { id: number } | GetApprovalDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDemandApprovalDetailVO>({
      url: `/demand/approvalDetail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 需求审批通过
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/approved
   * @secure
   */
  postApproved = (dto: defs.DemandVerifyDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/demand/approved`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 创建需求
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/create
   * @secure
   */
  postCreate = (dto: defs.DemandDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDemandDTO>({
      url: `/demand/create`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 删除需求
   *
   * @tags 需求审批管理controller
   * @request DELETE: /demand/delete/{id}
   * @secure
   */
  deleteDeleteById = ({ id }: { id: number } | DeleteDeleteById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/demand/delete/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 根据需求id获取详情设置
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/demand-delete/{id}
   * @secure
   */
  getDemandDeleteById = ({ id }: { id: number } | GetDemandDeleteById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDemandDetailVO>({
      url: `/demand/demand-delete/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取需求列表
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/demand/list
   * @secure
   */
  postDemandList = (dto: defs.DemandSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDemandInfoVO>({
      url: `/demand/demand/list`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取审批人部门列表
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/department/list
   * @secure
   */
  getDepartmentList = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDepartmentInfoVO>({
      url: `/demand/department/list`,
      method: "GET",
      ...params,
    });

  /**
   * 查看需求指标名是否可用
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/detail/checkMetricsName
   * @secure
   */
  postDetailCheckMetricsName = (dto: defs.DetailCheckNameDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntity>({
      url: `/demand/detail/checkMetricsName`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取用户审批需求记录列表-分页
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/forUser/page
   * @secure
   */
  postForUserPage = (dto: defs.DemandSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDemandDetailVO>({
      url: `/demand/forUser/page`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 根据id查看指标需求明细详情
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/get/detail/{id}
   * @secure
   */
  getGetDetailById = ({ id }: { id: number } | GetGetDetailById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDemandDetailVO>({
      url: `/demand/get/detail/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 根据id查看指标需求详情
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/get/{id}
   * @secure
   */
  getGetById = ({ id }: { id: number } | GetGetById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDemandVO>({
      url: `/demand/get/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 根据token解析用户信息
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/getUserByToken
   * @secure
   */
  getGetUserByToken = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityUser>({
      url: `/demand/getUserByToken`,
      method: "GET",
      ...params,
    });

  /**
   * 需要列表查询分页
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/query/page
   * @secure
   */
  postQueryPage = (dto: defs.DemandSearchDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDemandVO>({
      url: `/demand/query/page`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 需求审批驳回
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/reject
   * @secure
   */
  postReject = (dto: defs.DemandVerifyDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityString>({
      url: `/demand/reject`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 更新需求
   *
   * @tags 需求审批管理controller
   * @request POST: /demand/update
   * @secure
   */
  postUpdate = (dto: defs.DemandDTO, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDemandDTO>({
      url: `/demand/update`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取审批创建人列表
   *
   * @tags 需求审批管理controller
   * @request GET: /demand/user/list
   * @secure
   */
  getUserList = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListUserInfoVO>({
      url: `/demand/user/list`,
      method: "GET",
      ...params,
    });
}

export default new Demand();
